<cfsetting enablecfoutputonly="true">
<!--- @@displayname: Display latest Sponsors items --->

<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />

<cfset o = createObject("component",application.types['cfugwasponsors'].typepath)>
<cfset qRecordSet = queryNew("objectID") />
<cfset lCategoryObjectIDs = "" />
<cfset qObjectsMatchingCategories = queryNew("objectID") />

<cfif listLen(stObj.Category)>
	<cfset qObjectsMatchingCategories = createObject("component","farcry.core.packages.farcry.category").getData(typename="cfugwasponsors", lCategoryids=stobj.Category) />
	<cfset lCategoryObjectIDs = valueList(qObjectsMatchingCategories.objectid) />
</cfif>		

<cfset qRecordSet = o.getMultipleByQuery(maxRows=stObj.numItems, OrderBy="title", sortOrder="desc", lObjectIDs="#lCategoryObjectIDs#") />

<!--- IS THERE INTRO TEXT SET? --->
<cfif len(stObj.teaser)>		
	<cfset arrayAppend(request.aInvocations,stObj.teaser) />			
</cfif>

<cfoutput><div class="latestcfugwasponsorslist"></cfoutput>
<cfloop query="qRecordSet">
	<skin:view typename="cfugwasponsors" objectid="#qRecordSet.ObjectID#" webskin="displayTeaserStandard" />
</cfloop>
<cfoutput></div></cfoutput>

<cfsetting enablecfoutputonly="false">
